package com.plugin.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.plugin.core.model.entity.ElderCarePlan;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 护理计划Mapper接口
 * 
 * @author mark
 * @date 2025-07-29
 */
@Mapper
public interface ElderCarePlanMapper extends BaseMapper<ElderCarePlan> {

    /**
     * 查询所有护理计划记录
     * 包含床位号、长者姓名、护理内容、护理时间等信息
     * 
     * @return 护理计划记录列表
     */
    @Select("SELECT " +
            "    ecp.elder_id, " +
            "    ecp.plan_name as care_content, " +
            "    ecp.start_time as care_time, " +
            "    ecp.nurse_name, " +
            "    ecp.care_level, " +
            "    ecp.status, " +
            "    ecp.id " +
            "FROM elder_care_plan ecp " +
            "WHERE ecp.status = 1 " +
            "ORDER BY ecp.start_time DESC, ecp.id DESC limit 5")
    List<Map<String, Object>> getCarePlanRecords();

}
